<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page import="net.tribal.comic.entities.User" %>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <title><g:message code="user.show" default="Show User" /></title>
    </head>
    <body>
        <h1><g:message code="user.show" default="Show User" /></h1>
        
        <g:form>
        	<div class="roundedCorners wrapper dialog">
        
	        	<div class="nav">
		           <span class="menuButton"><g:link class="list" action="list"><g:message code="comic.list" default="USER LIST" /></g:link></span>
				</div>
				
				<g:if test="${flash.message}">
		            <div class="message"><g:message code="${flash.message}" args="${flash.args}" default="${flash.defaultMessage}" /></div>
		        </g:if>

                <table>
                        <tbody>
                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="user.id" default="Id" />:</td>
                                <td valign="top" class="value">${fieldValue(bean: userInstance, field: "id")}</td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="user.name" default="Name" />:</td>
                                <td valign="top" class="value">${fieldValue(bean: userInstance, field: "name")}</td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="user.lastName" default="Last Name" />:</td>
                                <td valign="top" class="value">${fieldValue(bean: userInstance, field: "lastName")}</td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="user.alias" default="Alias" />:</td>
                                <td valign="top" class="value">${fieldValue(bean: userInstance, field: "alias")}</td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="user.email" default="Email" />:</td>
                                <td valign="top" class="value">${fieldValue(bean: userInstance, field: "email")}</td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="user.comments" default="Comments" />:</td>
                                
                                <td  valign="top" style="text-align: left;" class="value">
                                    <ul>
                                    <g:each in="${userInstance?.comments}" var="commentInstance">
                                        <li><g:link controller="comment" action="show" id="${commentInstance.id}">${commentInstance.encodeAsHTML()}</g:link></li>
                                    </g:each>
                                    </ul>
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="user.birdDay" default="Bird Day" />:</td>
                                <td valign="top" class="value"><g:formatDate date="${userInstance?.birdDay}" /></td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="user.gender" default="Gender" />:</td>
                                <td valign="top" class="value">${fieldValue(bean: userInstance, field: "gender")}</td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="user.disabled" default="Disabled" />:</td>
                                <td valign="top" class="value"><g:formatBoolean boolean="${userInstance?.disabled}" /></td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="user.favoritesComics" default="Favorites Comics" />:</td>
                                <td  valign="top" style="text-align: left;" class="value">
                                    <ul>
                                    <g:each in="${userInstance?.favoritesComics}" var="comicInstance">
                                        <li><g:link controller="comic" action="show" id="${comicInstance.id}">${comicInstance.encodeAsHTML()}</g:link></li>
                                    </g:each>
                                    </ul>
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="user.country" default="Country" />:</td>
                                <td valign="top" class="value">${fieldValue(bean: userInstance, field: "country")}</td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="user.age" default="Age" />:</td>
                                <td valign="top" class="value">${fieldValue(bean: userInstance, field: "age")}</td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="user.fullName" default="Full Name" />:</td>
                                <td valign="top" class="value">${fieldValue(bean: userInstance, field: "fullName")}</td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name"><g:message code="user.rate" default="Rate" />:</td>
                                <td valign="top" class="value">${fieldValue(bean: userInstance, field: "rate")}</td>
                            </tr>
                        </tbody>
                    </table>
                    
                    <img src="${resource(dir:userInstance?.pathFile,file:userInstance?.nameFile)}" width="72" height="72" title="${userInstance?.alias}" alt="${userInstance?.alias}"/>
                    
                    <div class="buttons">
		                <span class="button"><g:actionSubmit class="edit" action="editProfile" value="${message(code: 'user.edit.profile', 'default': 'EDIT PROFILE')}" /></span>
		                <span class="button"><g:actionSubmit class="edit" action="editPassword" value="${message(code: 'user.edit.password', 'default': 'EDIT PASSWORD')}" /></span>
		                <span class="button"><g:actionSubmit class="edit" action="editFile" value="${message(code: 'user.edit.file', 'default': 'EDIT FILE')}" /></span>
		        		<span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'delete', 'default': 'Delete')}" onclick="return confirm('${message(code: 'delete.confirm', 'default': 'Are you sure?')}');" /></span>
		            </div>
                </div>
                
	            <g:hiddenField name="id" value="${userInstance?.id}" />
            </g:form>
    </body>
</html>